using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using SukiUI.Controls;
using SukiUI.Models;

namespace P2P.Client.UI
{
    public partial class MainView : SukiWindow
    {
        public MainView()
        {
            InitializeComponent();
        }

        private void MenuItem_OnClick(object? sender, RoutedEventArgs e)
        {
            if (DataContext is not MainViewModel vm) return;
            if (e.Source is not MenuItem mItem) return;
            if (mItem.DataContext is not SukiColorTheme cTheme) return;
            vm.ChangeTheme(cTheme);
        }

        private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e)
        {
            IsMenuVisible = !IsMenuVisible;
        }

        private void MakeFullScreenPressed(object? sender, PointerPressedEventArgs e)
        {
            WindowState = WindowState == WindowState.FullScreen ? WindowState.Normal : WindowState.FullScreen;
            IsTitleBarVisible = WindowState != WindowState.FullScreen;
        }
    }
}
